home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Mac / Lib / lib-scripting / CodeWarrior_Standard_Suite.py < prev    next >
Encoding:
Python Source  |  2000-06-23  |  11.3 KB  |  424 lines

  1. """Suite CodeWarrior Standard Suite: Standard suite events supported by the CodeWarrior IDE.
  2. Level 1, version 1
  3.  
  4. Generated from flap:Metrowerks:Metrowerks CodeWarrior:CodeWarrior IDE 2.0.1
  5. AETE/AEUT resource version 1/0, language 0, script 0
  6. """
  7.  
  8. import aetools
  9. import MacOS
  10.  
  11. _code = 'CWIE'
  12.  
  13. class CodeWarrior_Standard_Suite:
  14.  
  15.     _argmap_close = {
  16.         'saving' : 'savo',
  17.         'saving_in' : 'kfil',
  18.     }
  19.  
  20.     def close(self, _object, _attributes={}, **_arguments):
  21.         """close: Close an object
  22.         Required argument: the object to close
  23.         Keyword argument saving: Specifies whether or not changes should be saved before closing
  24.         Keyword argument saving_in: the file in which to save the object
  25.         Keyword argument _attributes: AppleEvent attribute dictionary
  26.         """
  27.         _code = 'core'
  28.         _subcode = 'clos'
  29.  
  30.         aetools.keysubst(_arguments, self._argmap_close)
  31.         _arguments['----'] = _object
  32.  
  33.         aetools.enumsubst(_arguments, 'savo', _Enum_savo)
  34.  
  35.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  36.                 _arguments, _attributes)
  37.         if _arguments.has_key('errn'):
  38.             raise aetools.Error, aetools.decodeerror(_arguments)
  39.         # XXXX Optionally decode result
  40.         if _arguments.has_key('----'):
  41.             return _arguments['----']
  42.  
  43.     _argmap_count = {
  44.         'each' : 'kocl',
  45.     }
  46.  
  47.     def count(self, _object, _attributes={}, **_arguments):
  48.         """count: Return the number of elements of a particular class within an object
  49.         Required argument: the object whose elements are to be counted
  50.         Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript
  51.         Keyword argument _attributes: AppleEvent attribute dictionary
  52.         Returns: the number of elements
  53.         """
  54.         _code = 'core'
  55.         _subcode = 'cnte'
  56.  
  57.         aetools.keysubst(_arguments, self._argmap_count)
  58.         _arguments['----'] = _object
  59.  
  60.  
  61.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  62.                 _arguments, _attributes)
  63.         if _arguments.has_key('errn'):
  64.             raise aetools.Error, aetools.decodeerror(_arguments)
  65.         # XXXX Optionally decode result
  66.         if _arguments.has_key('----'):
  67.             return _arguments['----']
  68.  
  69.     _argmap_get = {
  70.         'as' : 'rtyp',
  71.     }
  72.  
  73.     def get(self, _object, _attributes={}, **_arguments):
  74.         """get: Get the data for an object
  75.         Required argument: the object whose data is to be returned
  76.         Keyword argument as: the desired types for the data, in order of preference
  77.         Keyword argument _attributes: AppleEvent attribute dictionary
  78.         Returns: The data from the object
  79.         """
  80.         _code = 'core'
  81.         _subcode = 'getd'
  82.  
  83.         aetools.keysubst(_arguments, self._argmap_get)
  84.         _arguments['----'] = _object
  85.  
  86.  
  87.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  88.                 _arguments, _attributes)
  89.         if _arguments.has_key('errn'):
  90.             raise aetools.Error, aetools.decodeerror(_arguments)
  91.         # XXXX Optionally decode result
  92.         if _arguments.has_key('----'):
  93.             return _arguments['----']
  94.  
  95.     _argmap_make = {
  96.         'new' : 'kocl',
  97.         'at' : 'insh',
  98.         'with_data' : 'data',
  99.         'with_properties' : 'prdt',
  100.     }
  101.  
  102.     def make(self, _no_object=None, _attributes={}, **_arguments):
  103.         """make: Make a new element
  104.         Keyword argument new: the class of the new element. Keyword 'new' is optional in AppleScript
  105.         Keyword argument at: the location at which to insert the element
  106.         Keyword argument with_data: the initial data for the element
  107.         Keyword argument with_properties: the initial values for the properties of the element
  108.         Keyword argument _attributes: AppleEvent attribute dictionary
  109.         Returns: to the new object(s)
  110.         """
  111.         _code = 'core'
  112.         _subcode = 'crel'
  113.  
  114.         aetools.keysubst(_arguments, self._argmap_make)
  115.         if _no_object != None: raise TypeError, 'No direct arg expected'
  116.  
  117.  
  118.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  119.                 _arguments, _attributes)
  120.         if _arguments.has_key('errn'):
  121.             raise aetools.Error, aetools.decodeerror(_arguments)
  122.         # XXXX Optionally decode result
  123.         if _arguments.has_key('----'):
  124.             return _arguments['----']
  125.  
  126.     def select(self, _object=None, _attributes={}, **_arguments):
  127.         """select: Select the specified object
  128.         Required argument: the object to select
  129.         Keyword argument _attributes: AppleEvent attribute dictionary
  130.         """
  131.         _code = 'misc'
  132.         _subcode = 'slct'
  133.  
  134.         if _arguments: raise TypeError, 'No optional args expected'
  135.         _arguments['----'] = _object
  136.  
  137.  
  138.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  139.                 _arguments, _attributes)
  140.         if _arguments.has_key('errn'):
  141.             raise aetools.Error, aetools.decodeerror(_arguments)
  142.         # XXXX Optionally decode result
  143.         if _arguments.has_key('----'):
  144.             return _arguments['----']
  145.  
  146.     _argmap_set = {
  147.         'to' : 'data',
  148.     }
  149.  
  150.     def set(self, _object, _attributes={}, **_arguments):
  151.         """set: Set an object's data
  152.         Required argument: the object to change
  153.         Keyword argument to: the new value
  154.         Keyword argument _attributes: AppleEvent attribute dictionary
  155.         """
  156.         _code = 'core'
  157.         _subcode = 'setd'
  158.  
  159.         aetools.keysubst(_arguments, self._argmap_set)
  160.         _arguments['----'] = _object
  161.  
  162.  
  163.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  164.                 _arguments, _attributes)
  165.         if _arguments.has_key('errn'):
  166.             raise aetools.Error, aetools.decodeerror(_arguments)
  167.         # XXXX Optionally decode result
  168.         if _arguments.has_key('----'):
  169.             return _arguments['----']
  170.  
  171.  
  172. class application(aetools.ComponentItem):
  173.     """application - An application program"""
  174.     want = 'capp'
  175. class user_interaction(aetools.NProperty):
  176.     """user interaction - User interaction level"""
  177.     which = 'inte'
  178.     want = 'Inte'
  179. #        element 'docu' as ['indx', 'name', 'rang']
  180. #        element 'cwin' as ['indx', 'name', 'rang']
  181. #        element 'Clas' as ['indx', 'name']
  182.  
  183. class character(aetools.ComponentItem):
  184.     """character - A character"""
  185.     want = 'cha '
  186. class offset(aetools.NProperty):
  187.     """offset - offset of a text object from the beginning of the document (first char has offset 1)"""
  188.     which = 'pOff'
  189.     want = 'long'
  190. class length(aetools.NProperty):
  191.     """length - length in characters of this object"""
  192.     which = 'pLen'
  193.     want = 'long'
  194.  
  195. class document(aetools.ComponentItem):
  196.     """document - A document"""
  197.     want = 'docu'
  198. class file(aetools.NProperty):
  199.     """file - The file of the document"""
  200.     which = 'file'
  201.     want = 'fss '
  202. class index(aetools.NProperty):
  203.     """index - the number of the document"""
  204.     which = 'pidx'
  205.     want = 'long'
  206. class mode(aetools.NProperty):
  207.     """mode - The document’s open mode"""
  208.     which = 'Mode'
  209.     want = 'Mode'
  210. class modified(aetools.NProperty):
  211.     """modified - Has the document been modified since the last save?"""
  212.     which = 'imod'
  213.     want = 'bool'
  214. class name(aetools.NProperty):
  215.     """name - the title of the document"""
  216.     which = 'pnam'
  217.     want = 'itxt'
  218. class selection(aetools.NProperty):
  219.     """selection - the selection visible to the user"""
  220.     which = 'sele'
  221.     want = 'csel'
  222. class window(aetools.NProperty):
  223.     """window - The window of this document."""
  224.     which = 'cwin'
  225.     want = 'cwin'
  226. #        element 'cha ' as ['indx', 'rele', 'rang', 'test']
  227. #        element 'cins' as ['rele']
  228. #        element 'clin' as ['indx', 'rang', 'rele']
  229. #        element 'ctxt' as ['rang']
  230.  
  231. documents = document
  232.  
  233. class file(aetools.ComponentItem):
  234.     """file - A file"""
  235.     want = 'file'
  236.  
  237. files = file
  238.  
  239. class insertion_point(aetools.ComponentItem):
  240.     """insertion point - An insertion location between two objects"""
  241.     want = 'cins'
  242. # repeated property length length of text object (in characters)
  243. # repeated property offset offset of a text object from the beginning of the document (first char has offset 1)
  244.  
  245. class line(aetools.ComponentItem):
  246.     """line - Lines of text"""
  247.     want = 'clin'
  248. # repeated property index index of a line object from the beginning of the document (first line has index 1)
  249. # repeated property offset offset  (in characters) of a line object from the beginning of the document
  250. # repeated property length length in characters of this object
  251. #        element 'cha ' as ['indx', 'rang', 'rele']
  252.  
  253. lines = line
  254.  
  255. class selection_2d_object(aetools.ComponentItem):
  256.     """selection-object - the selection visible to the user"""
  257.     want = 'csel'
  258. class contents(aetools.NProperty):
  259.     """contents - the contents of the selection"""
  260.     which = 'pcnt'
  261.     want = 'type'
  262. # repeated property length length of text object (in characters)
  263. # repeated property offset offset of a text object from the beginning of the document (first char has offset 1)
  264. #        element 'cha ' as ['indx', 'rele', 'rang', 'test']
  265. #        element 'clin' as ['indx', 'rang', 'rele']
  266. #        element 'ctxt' as ['rang']
  267.  
  268. class text(aetools.ComponentItem):
  269.     """text - Text"""
  270.     want = 'ctxt'
  271. # repeated property length length of text object (in characters)
  272. # repeated property offset offset of a text object from the beginning of the document (first char has offset 1)
  273. #        element 'cha ' as ['indx', 'rele', 'rang']
  274. #        element 'cins' as ['rele']
  275. #        element 'clin' as ['indx', 'rang', 'rele']
  276. #        element 'ctxt' as ['rang']
  277.  
  278. class window(aetools.ComponentItem):
  279.     """window - A window"""
  280.     want = 'cwin'
  281. # repeated property name the title of the window
  282. # repeated property index the number of the window
  283. class bounds(aetools.NProperty):
  284.     """bounds - the boundary rectangle for the window"""
  285.     which = 'pbnd'
  286.     want = 'qdrt'
  287. class document(aetools.NProperty):
  288.     """document - the document object that owns this window"""
  289.     which = 'docu'
  290.     want = 'docu'
  291. class position(aetools.NProperty):
  292.     """position - upper left coordinates of window"""
  293.     which = 'ppos'
  294.     want = 'QDpt'
  295. class visible(aetools.NProperty):
  296.     """visible - is the window visible?"""
  297.     which = 'pvis'
  298.     want = 'bool'
  299. class zoomed(aetools.NProperty):
  300.     """zoomed - Is the window zoomed?"""
  301.     which = 'pzum'
  302.     want = 'bool'
  303.  
  304. windows = window
  305. # XXXX application element 'Clas' not found!!
  306. application._propdict = {
  307.     'user_interaction' : user_interaction,
  308. }
  309. application._elemdict = {
  310.     'document' : document,
  311.     'window' : window,
  312. }
  313. character._propdict = {
  314.     'offset' : offset,
  315.     'length' : length,
  316. }
  317. character._elemdict = {
  318. }
  319. document._propdict = {
  320.     'file' : file,
  321.     'index' : index,
  322.     'mode' : mode,
  323.     'modified' : modified,
  324.     'name' : name,
  325.     'selection' : selection,
  326.     'window' : window,
  327. }
  328. document._elemdict = {
  329.     'character' : character,
  330.     'insertion_point' : insertion_point,
  331.     'line' : line,
  332.     'text' : text,
  333. }
  334. file._propdict = {
  335. }
  336. file._elemdict = {
  337. }
  338. insertion_point._propdict = {
  339.     'length' : length,
  340.     'offset' : offset,
  341. }
  342. insertion_point._elemdict = {
  343. }
  344. line._propdict = {
  345.     'index' : index,
  346.     'offset' : offset,
  347.     'length' : length,
  348. }
  349. line._elemdict = {
  350.     'character' : character,
  351. }
  352. selection_2d_object._propdict = {
  353.     'contents' : contents,
  354.     'length' : length,
  355.     'offset' : offset,
  356. }
  357. selection_2d_object._elemdict = {
  358.     'character' : character,
  359.     'line' : line,
  360.     'text' : text,
  361. }
  362. text._propdict = {
  363.     'length' : length,
  364.     'offset' : offset,
  365. }
  366. text._elemdict = {
  367.     'character' : character,
  368.     'insertion_point' : insertion_point,
  369.     'line' : line,
  370.     'text' : text,
  371. }
  372. window._propdict = {
  373.     'name' : name,
  374.     'index' : index,
  375.     'bounds' : bounds,
  376.     'document' : document,
  377.     'position' : position,
  378.     'visible' : visible,
  379.     'zoomed' : zoomed,
  380. }
  381. window._elemdict = {
  382. }
  383. # XXXX enum savo not found!!
  384.  
  385. #
  386. # Indices of types declared in this module
  387. #
  388. _classdeclarations = {
  389.     'docu' : document,
  390.     'cins' : insertion_point,
  391.     'capp' : application,
  392.     'ctxt' : text,
  393.     'csel' : selection_2d_object,
  394.     'clin' : line,
  395.     'file' : file,
  396.     'cwin' : window,
  397.     'cha ' : character,
  398. }
  399.  
  400. _propdeclarations = {
  401.     'pzum' : zoomed,
  402.     'pOff' : offset,
  403.     'pLen' : length,
  404.     'pnam' : name,
  405.     'file' : file,
  406.     'pcnt' : contents,
  407.     'cwin' : window,
  408.     'ppos' : position,
  409.     'pidx' : index,
  410.     'docu' : document,
  411.     'pvis' : visible,
  412.     'sele' : selection,
  413.     'pbnd' : bounds,
  414.     'imod' : modified,
  415.     'Mode' : mode,
  416.     'inte' : user_interaction,
  417. }
  418.  
  419. _compdeclarations = {
  420. }
  421.  
  422. _enumdeclarations = {
  423. }
  424.